<?php

namespace App\Http\Requests\Game\Other\Broadcast;

use App\Http\Requests\Request;
use App\Models\Game\Config\Broadcast\Broadcast;
use Illuminate\Validation\Rule;

class ItemRequest extends Request
{

    /**
     * 应用于请求的验证规则。
     *
     * @return array
     */
    public function rules()
    {
        return [
            'id' => 'nullable|integer|min:1',
            'plat_code' => ['required', 'string', 'max:64',
                Rule::unique(Broadcast::connectionName() . '.' . Broadcast::tableName())->ignore($this->input('id', 0))
            ],

            'enable' => 'required|integer|in:0,1',
            'expire_time' => 'nullable|integer|min:0',

            'content_ids.*' => 'required|integer|min:1',
            'content_param.*' => 'required|string|max:128',
        ];
    }

    /**
     * 自定义验证规则的错误消息。
     *
     * @return array
     */
    public function messages()
    {
        return [];
    }

    /**
     * 自定义字段名称。
     *
     * @return array
     */
    public function attributes()
    {
        return [];
    }
}
